package com.jasper.controller;

import com.jasper.pojo.Orders;
import com.jasper.service.center.MyOrderService;
import com.jasper.utils.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.io.File;

@Controller
public class BaseController {
    public static final Integer COMMON_PAGE_SIZE = 10;
    public static final Integer PAGE_SIZE = 20;

    //购物车 Cookie  跟前端一个
    public static final String FOODIE_SHOPCART = "shopcart";

    // 支付中心的调用地址
    String paymentUrl = "http://payment.t.mukewang.com/foodie-payment/payment/createMerchantOrder";

    // 微信支付成功 --> 支付中心 --> 天天吃货平台
    //                        |--> 回调通知的url
    public String payReturnUrl = "http://ncv74p.natappfree.cc/orders/notifyMerchantOrderPaid";

    // 用户上传头像的地址
    public static final String IMAGE_USER_FACE_LOCATION = "D:" + File.separator + "applications" + File.separator
            + "apache-tomcat-9.0.41" + File.separator + "webapps" + File.separator + "fooddie_image";

    @Autowired
    public MyOrderService myOrderService;

    public JSONResult checkUserOrder(String userId, String orderId){
        Orders orders = myOrderService.queryMyOrder(userId, orderId);
        if(orders==null){
            return JSONResult.errorMsg("订单不存在");
        }
        return JSONResult.ok(orders);
    }
}
